/**
 * @file   main.cpp
 * @author lizhiqi 
 * @date   Fri Sep 18 17:46:39 2020
 * 
 * @brief  InsertSort from largest to smallest
 * 
 * 
 */


#include <iostream>
#include <cstdlib>


int re_INSERTION_SORT(double A[], int length);

int re_INSERTION_SORT(double A[], int length)
{
    for (int j = 1; j < length; j++)
    {
	double key = A[j];
	int i = j - 1;
	while (i >= 0 && A[i] < key)
	{
	    A[i + 1] = A[i];
	    i = i - 1;
	}
	A[i + 1] = key;
    }
    return 0;
};


int main(int argc, char *argv[])
{
    int N;
    std::cin >> N;
    double *A = NULL;
    if ((A = (double *)std::malloc(sizeof(double) * N)) == NULL)
    {
	std::cerr << "No enough memory" << std::endl;
	std::exit(-1);
    }
    for (int i = 0; i < N; i++)
	std::cin >> A[i];

    re_INSERTION_SORT(A, N);
    std::cout << N << " ";
    for (int i = 0; i < N; i++)
	std::cout << A[i] << " ";
    std::cout << std::endl;
    return 0;
};
